package Test_0817.book;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 * Dare: 2024-08-17
 * Time: 18:30
 */
/*书：
    书名；
    作者姓名；
    书的类型；
    价格；
    是否借出；//作为一个图书系统要判断这个本书是否被借出*/
public class Book {
     private String name;//书名
     private String author;//作者姓名
     private String type;//书的类型
     private int price;//价格；
    //isBorrowed是boolean类型，是基本数据类型，其默认值为false，而Boolean是包装类，是默认值为null
     private boolean isBorrowed;//是否借出
    //isBorrow不用进行初始化（构造方法），boolean类型其默认为false
    public Book(String name, String author, String type, int price) {
        this.name = name;
        this.author = author;
        this.type = type;
        this.price = price;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public int getPrice() {
        return price;
    }
    public void setPrice(int price) {
        this.price = price;
    }
    public boolean isBorrowed() {
        return isBorrowed;
    }
    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }
    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", type='" + type + '\'' +
                ", price=" + price +","+
                ((isBorrowed==true)?"已借出":"未借出")+
                '}';
    }
}
